<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="text"/>

	<xsl:param name="username">marius</xsl:param>

	<xsl:template match="/agenda">
		<xsl:apply-templates select="contact"/>
	</xsl:template>

	<xsl:template match="contact">
		<xsl:if test="@username=$username">
			<xsl:variable name="givenName" select="givenName"/>
			<xsl:variable name="middleName" select="middleName"/>
			<xsl:variable name="familyName" select="familyName"/>
			BEGIN:VCARD
			VERSION:2.1
			<xsl:variable name="fn">
				<xsl:value-of select="$givenName"/>
				<xsl:text> </xsl:text>
				<xsl:if test="$middleName">
					<xsl:value-of select="middleName"/>
					<xsl:text> </xsl:text>
				</xsl:if>
				<xsl:value-of select="$familyName"/>
				<xsl:text> </xsl:text>
			</xsl:variable>FN:<xsl:value-of select="$fn"/>
			N:<xsl:value-of select="$givenName"/>;<xsl:value-of select="$middleName"/>;<xsl:value-of select="$familyName"/>;;
			<xsl:variable name="orgName" select="organization"/>
			<xsl:variable name="org">
				<xsl:if test="$orgName">
					<xsl:value-of select="$orgName"/>
				</xsl:if>
			</xsl:variable>ADR;WORK:;<xsl:if test="$orgName">
				<xsl:value-of select="$org"/>;</xsl:if><xsl:value-of select="address/street"/>;<xsl:value-of select="address/city"/>;;;<xsl:value-of select="address/country"/>
			<xsl:variable name="telNr" select="phone"/>
			<xsl:variable name="phone">
				<xsl:if test="$telNr">
					<xsl:value-of select="$telNr"/>
				</xsl:if>
			</xsl:variable>
			<xsl:if test="$telNr">
			TEL;PREF;WORK:<xsl:value-of select="$phone"/></xsl:if>
			EMAIL;INTERNET:<xsl:value-of select="email"/>
			END:VCARD
		</xsl:if>
	</xsl:template>
</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2006. Progress Software Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="yes" name="Scenario1" userelativepaths="yes" externalpreview="no" url="..\..\xmlDb\agenda.xml" htmlbaseurl="" outputurl="" processortype="internal" useresolver="yes" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext="" validateoutput="no" validator="internal" customvalidator=""/></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no" ><SourceSchema srcSchemaPath="..\..\xmlDb\agenda.xml" srcSchemaRoot="agenda" AssociatedInstance="" loaderFunction="document" loaderFunctionUsesURI="no"/></MapperInfo><MapperBlockPosition><template match="/agenda"><block path="xsl:apply&#x2D;templates" x="178" y="0"/></template></MapperBlockPosition><TemplateContext></TemplateContext><MapperFilter side="source"></MapperFilter></MapperMetaTag>
</metaInformation>
-->